<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Local Inter-Process Communication</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Local_Inter-Process_Communication"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Local_Inter-Process_Communication rootpage-Local_Inter-Process_Communication skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Local Inter-Process Communication</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><p>The <b>Local Inter-Process Communication</b><sup id="cite_ref-ntdebugging_1-0" class="reference"><a href="#cite_note-ntdebugging-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> (<b>LPC</b>, often also referred to as <b>Local Procedure Call</b> or <b>Lightweight Procedure Call</b>) is an internal, undocumented <a href="Inter-process_communication" title="Inter-process communication">inter-process communication</a> facility provided by the <a href="Microsoft" title="Microsoft">Microsoft</a> <a href="Windows_NT" title="Windows NT">Windows NT</a> <a href="Kernel_(operating_system)" title="Kernel (operating system)">kernel</a> for lightweight <a href="Inter-process_communication" title="Inter-process communication">IPC</a> between <a href="Process_(computing)" title="Process (computing)">processes</a> on the same computer. As of <a href="Windows_Vista" title="Windows Vista">Windows Vista</a>, LPC has been rewritten as <b>Asynchronous Local Inter-Process Communication</b><sup id="cite_ref-ntdebugging_1-1" class="reference"><a href="#cite_note-ntdebugging-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> (<b>ALPC</b>, often also <b>Advanced Local Procedure Call</b>) in order to provide a high-speed scalable communication mechanism required to efficiently implement <a href="User-Mode_Driver_Framework" title="User-Mode Driver Framework">User-Mode Driver Framework</a> (UMDF), whose user-mode parts require an efficient communication channel with UMDF's components in the <a href="Architecture_of_Windows_NT#Executive" title="Architecture of Windows NT">executive</a>.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</p><p>The (A)LPC interface is part of Windows NT's undocumented <a href="Windows_Native_API" title="Windows Native API">Native API</a>, and as such is not available to applications for direct use. However, it can be used indirectly in the following instances:
</p>
<ul><li>when using the <a href="Microsoft_RPC" title="Microsoft RPC">Microsoft RPC</a> API to communicate locally, i.e. between the processes on the same machine</li>
<li>by calling Windows APIs that are implemented with (A)LPC (see below)</li></ul>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Implementation">Implementation</h2></div>
<p>(A)LPC is implemented using kernel "port" objects, which are securable (with <a href="Access-control_list" title="Access-control list">ACLs</a>, allowing e.g. only specific <a href="Security_Identifier" title="Security Identifier">SIDs</a> to use them) and allow identification of the process on the other side of the connection. Individual messages are also securable: applications can set per-message SIDs, and also test for changes of the security context in the token associated with the (A)LPC message.
</p><p>The typical communication scenario between the server and the client is as follows:
</p>
<ol><li>A server process first creates a <i>named server connection port</i> object, and waits for clients to connect.</li>
<li>A client requests a connection to that named port by sending a connect message.</li>
<li>If the server accepts the connection, two <i>unnamed</i> ports are created:
<ul><li><i>client communication port</i> - used by client threads to communicate with a particular server</li>
<li><i>server communication port</i> - used by the server to communicate with a particular client; one such port per client is created</li></ul></li>
<li>The client receives a handle to the client communication port, and server receives a handle to the server communication port, and the inter-process communication channel is established.</li></ol>
<p>(A)LPC supports the following three modes of message exchange between the server and client:<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p>
<ul><li>For short messages (fewer than 256 bytes) the kernel copies the message buffers between processes, from the <a href="Address_space" title="Address space">address space</a> of the sending process to the system address space, and from there to the receiving process' address space.</li>
<li>For messages longer than 256 bytes a shared memory section must be used to transfer data, which the (A)LPC service maps between the sending and receiving processes. First the sender places data into the shared memory, and then sends a notification (e.g. a small message, using the first method of (A)LPC) to the receiving process pointing to the sent data in the shared memory section.</li>
<li>Server can directly read and write data from the client's address space, when the amount of data is too large to fit in a shared section.</li></ul>
<p>ALPC has a performance advantage over the former LPC interface, as it can be configured to use <a href="Input/output_completion_port" title="Input/output completion port">I/O completion ports</a> instead of synchronous request/reply mechanism that LPC exclusively uses.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> This enables ALPC ports high-speed communication which automatically balances the number of messages and threads. Additionally, ALPC messages can be batched together so as to minimize user-mode/kernel-mode switches.
</p>
<div class="mw-heading mw-heading2"><h2 id="Known_usage">Known usage</h2></div>
<p>(A)LPC is used heavily in communication between internal subsystems in Windows NT. The Win32 subsystem uses (A)LPC heavily for communication between client and the subsystem server (<a href="Client/Server_Runtime_Subsystem" title="Client/Server Runtime Subsystem">CSRSS</a>). Quick LPC was introduced in version 3.51 of Windows NT to make these calls faster. This method was largely abandoned in version 4.0 in favor of moving the performance critical server portions into kernel mode (win32k.sys).
</p><p>The <a href="Local_Security_Authority_Subsystem_Service" title="Local Security Authority Subsystem Service">Local Security Authority Subsystem Service</a> (LSASS), <a href="Session_Manager" class="mw-redirect" title="Session Manager">Session Manager</a> (SMSS), and <a href="Service_Control_Manager" title="Service Control Manager">Service Control Manager</a> all use (A)LPC ports directly to communicate with client processes. <a href="Winlogon" title="Winlogon">Winlogon</a> and the <a href="Reference_monitor" title="Reference monitor">Security Reference Monitor</a> use it to communicate with the LSASS process.
</p><p>As mentioned, Microsoft RPC can use (A)LPC as a transport when the client and server are both on the same machine. Many services that are designed to communicate only on the local computer use (A)LPC as the only transport through RPC. The implementation of remote <a href="Object_Linking_and_Embedding" title="Object Linking and Embedding">OLE</a> and <a href="Distributed_Component_Object_Model" title="Distributed Component Object Model">DCOM</a> in many cases uses (A)LPC for local communication as well.
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Doors_(computing)" title="Doors (computing)">Doors</a></li>
<li><a href="Remote_procedure_call" title="Remote procedure call">Remote procedure call</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="Notes">Notes</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-ntdebugging-1"><span class="mw-cite-backlink">^ <a href="#cite_ref-ntdebugging_1-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-ntdebugging_1-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://docs.microsoft.com/en-us/archive/blogs/ntdebugging/lpc-local-procedure-calls-part-1-architecture">"LPC (Local procedure calls) Part 1 architecture"</a>. <i><a href="Microsoft_Docs" title="Microsoft Docs">Microsoft Docs</a></i>.</cite></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><a href="#CITEREFRussinovichSolomonIonescu2009">Russinovich, Solomon & Ionescu (2009</a>:201)</span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><a href="#CITEREFRussinovichSolomonIonescu2009">Russinovich, Solomon & Ionescu (2009</a>:203)</span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><a href="#CITEREFRussinovichSolomonIonescu2009">Russinovich, Solomon & Ionescu (2009</a>:204)</span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<ul><li><cite id="CITEREFDabakBoratePhadke1999" class="citation cs2">Dabak, Prasad; Borate, Milind; Phadke, Sandeep (1999), <i>Undocumented Windows NT</i>, <a href="Hungry_Minds" class="mw-redirect" title="Hungry Minds">Hungry Minds</a>, <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>0-7645-4569-8</bdi></cite></li>
<li><cite id="CITEREFRussinovichSolomonIonescu2009" class="citation cs2"><a href="Mark_Russinovich" title="Mark Russinovich">Russinovich, Mark</a>; Solomon, David; Ionescu, Alex (2009), <i>Windows® Internals</i> (5th ed.), <a href="Microsoft_Press" title="Microsoft Press">Microsoft Press</a>, <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-0-7356-2530-3</bdi></cite></li></ul>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<ul><li><a rel="nofollow" class="external text" href="https://web.archive.org/web/20080612141354/http://www.windowsitlibrary.com/Content/356/08/toc.html">Local Procedure Call</a> at the <a href="Wayback_Machine" title="Wayback Machine">Wayback Machine</a> (archived June 12, 2008) — Includes explanation of undocumented functions</li>
<li><a rel="nofollow" class="external text" href="http://www.zezula.net/en/prog/lpc.html">LPC Communication</a></li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2023-03-12" href="https://en.wikipedia.org/wiki/?title=Local_Inter-Process_Communication&oldid=1144141301">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>